package cn.itheima.dao;

import cn.itheima.domain.system.Role;
import cn.itheima.domain.system.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by millions on 2017/7/20.
 */
public interface RoleRepository extends JpaRepository<Role,Integer> {

    @Query("from Role r inner join fetch r.users u where u.id=?")
    List<Role> findByUser(Integer id) ;
}
